\hypertarget{group__stream}{}\section{流}
\label{group__stream}\index{流@{流}}
\subsection*{函数}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{group__stream_ga6e109b2dc520782567dc1891af3b945e}{stream\+\_\+available} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream)
\item 
int \hyperlink{group__stream_gaef7f4ca2c201faf5d82a1dad4c8d7814}{stream\+\_\+eat\+\_\+all} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream)
\item 
int \hyperlink{group__stream_ga1ab922f8bab979099b3abc3ee54dc59d}{stream\+\_\+eat} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream, int size)
\item 
int \hyperlink{group__stream_ga6e01758abf49f8b08cd457f1cb48a954}{stream\+\_\+pop} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream, void $\ast$buffer, int size)
\item 
int \hyperlink{group__stream_gae7e63ef142733eb3aea7401e28bc9a75}{stream\+\_\+push} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream, const void $\ast$buffer, int size)
\item 
int \hyperlink{group__stream_ga380555bf71ee99f6b2bb4f76738d507f}{stream\+\_\+copy} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream, void $\ast$buffer, int size)
\item 
int \hyperlink{group__stream_gad5336c2b89b6edea5f277d5ebc221e15}{stream\+\_\+push\+\_\+stream} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream, \hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$target)
\item 
int \hyperlink{group__stream_ga296aea89ba5bec6566e119855df3b18c}{stream\+\_\+copy\+\_\+stream} (\hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$stream, \hyperlink{struct__stream__t}{stream\+\_\+t} $\ast$target)
\end{DoxyCompactItemize}


\subsection{详细描述}

\begin{DoxyPre}
管道流\end{DoxyPre}



\begin{DoxyPre}stream\_t通过调用函数channel\_ref\_get\_stream取得. 管道流提供了基于流的数据操作
以及特殊的针对性的方法用于提高操作效率.\end{DoxyPre}



\begin{DoxyPre}1. stream\_available   获取流内可读字节数
2. stream\_eat\_all     丢弃流内所有可读字节
3. stream\_eat         丢弃流内指定数量的字节
4. stream\_pop         从流内读取数据
5. stream\_push        向流内写数据
6. stream\_copy        从流内拷贝指定数量的可读字节，但不清除这些字节，通常用于协议检测
7. stream\_push\_stream 将流内所有可读字节写入另一个流，不需要额外拷贝, 可用于网关的数据中转
8. stream\_copy\_stream 将流内所有可读字节写入另一个流，不需要额外拷贝, 但不清除这些字节，可用于广播\end{DoxyPre}



\begin{DoxyPre}以上这些函数的设计除了基础的流本身的功能以外，还考虑了特定领域的应用，同时兼顾了效率.\end{DoxyPre}



\begin{DoxyPre}\end{DoxyPre}
 

\subsection{函数说明}
\hypertarget{group__stream_ga6e109b2dc520782567dc1891af3b945e}{}\index{流@{流}!stream\+\_\+available@{stream\+\_\+available}}
\index{stream\+\_\+available@{stream\+\_\+available}!流@{流}}
\subsubsection[{stream\+\_\+available}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+available (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{group__stream_ga6e109b2dc520782567dc1891af3b945e}
取得数据流内可读字节数 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
可读字节数 
\end{DoxyReturn}
\hypertarget{group__stream_ga380555bf71ee99f6b2bb4f76738d507f}{}\index{流@{流}!stream\+\_\+copy@{stream\+\_\+copy}}
\index{stream\+\_\+copy@{stream\+\_\+copy}!流@{流}}
\subsubsection[{stream\+\_\+copy}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+copy (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream, }
\item[{void $\ast$}]{buffer, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{group__stream_ga380555bf71ee99f6b2bb4f76738d507f}
从数据流内拷贝数据，但不清除数据流内数据 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区 \\
\hline
{\em size} & 缓冲区大小 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{group__stream_ga296aea89ba5bec6566e119855df3b18c}{}\index{流@{流}!stream\+\_\+copy\+\_\+stream@{stream\+\_\+copy\+\_\+stream}}
\index{stream\+\_\+copy\+\_\+stream@{stream\+\_\+copy\+\_\+stream}!流@{流}}
\subsubsection[{stream\+\_\+copy\+\_\+stream}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+copy\+\_\+stream (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream, }
\item[{{\bf stream\+\_\+t} $\ast$}]{target}
\end{DoxyParamCaption}
)}\label{group__stream_ga296aea89ba5bec6566e119855df3b18c}
将stream内数据写入target, 但不清除stream内数据 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
{\em target} & stream\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{group__stream_ga1ab922f8bab979099b3abc3ee54dc59d}{}\index{流@{流}!stream\+\_\+eat@{stream\+\_\+eat}}
\index{stream\+\_\+eat@{stream\+\_\+eat}!流@{流}}
\subsubsection[{stream\+\_\+eat}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+eat (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{group__stream_ga1ab922f8bab979099b3abc3ee54dc59d}
删除指定长度数据 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
{\em size} & 需要删除的长度 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{group__stream_gaef7f4ca2c201faf5d82a1dad4c8d7814}{}\index{流@{流}!stream\+\_\+eat\+\_\+all@{stream\+\_\+eat\+\_\+all}}
\index{stream\+\_\+eat\+\_\+all@{stream\+\_\+eat\+\_\+all}!流@{流}}
\subsubsection[{stream\+\_\+eat\+\_\+all}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+eat\+\_\+all (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{group__stream_gaef7f4ca2c201faf5d82a1dad4c8d7814}
清空数据流 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{group__stream_ga6e01758abf49f8b08cd457f1cb48a954}{}\index{流@{流}!stream\+\_\+pop@{stream\+\_\+pop}}
\index{stream\+\_\+pop@{stream\+\_\+pop}!流@{流}}
\subsubsection[{stream\+\_\+pop}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+pop (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream, }
\item[{void $\ast$}]{buffer, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{group__stream_ga6e01758abf49f8b08cd457f1cb48a954}
从数据流内读取数据并清除数据 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区 \\
\hline
{\em size} & 缓冲区大小 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{group__stream_gae7e63ef142733eb3aea7401e28bc9a75}{}\index{流@{流}!stream\+\_\+push@{stream\+\_\+push}}
\index{stream\+\_\+push@{stream\+\_\+push}!流@{流}}
\subsubsection[{stream\+\_\+push}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+push (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream, }
\item[{const void $\ast$}]{buffer, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{group__stream_gae7e63ef142733eb3aea7401e28bc9a75}
向数据流内写数据 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区 \\
\hline
{\em size} & 缓冲区大小 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{group__stream_gad5336c2b89b6edea5f277d5ebc221e15}{}\index{流@{流}!stream\+\_\+push\+\_\+stream@{stream\+\_\+push\+\_\+stream}}
\index{stream\+\_\+push\+\_\+stream@{stream\+\_\+push\+\_\+stream}!流@{流}}
\subsubsection[{stream\+\_\+push\+\_\+stream}]{\setlength{\rightskip}{0pt plus 5cm}int stream\+\_\+push\+\_\+stream (
\begin{DoxyParamCaption}
\item[{{\bf stream\+\_\+t} $\ast$}]{stream, }
\item[{{\bf stream\+\_\+t} $\ast$}]{target}
\end{DoxyParamCaption}
)}\label{group__stream_gad5336c2b89b6edea5f277d5ebc221e15}
将stream内数据写入target, 并清除stream内数据 
\begin{DoxyParams}{参数}
{\em stream} & stream\+\_\+t实例 \\
\hline
{\em target} & stream\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
